import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:readmore/readmore.dart';
import 'package:smart_shop/model/charge_standard.dart';
import 'package:smart_shop/utils/colorUtils.dart';

class ShopInfo extends StatefulWidget {
  const ShopInfo({Key? key}) : super(key: key);

  @override
  State<ShopInfo> createState() => _ShopInfoState();
}

class _ShopInfoState extends State<ShopInfo> {
  late String content =
      '【公司介绍】北海家欢家政服务有限公司，是一家正规的家政服务公司，经过经商管理部门正式注册的公司，让每个家庭都能获得诚信、便捷、有保障的家政服务。 【服务优势】公司员工来源清晰，经验丰富，经过专业的老师培训后合格上岗。他们会烧饭、保洁、整理家务，有带宝宝的经验和家政服务经验。完全让您放心、安心，望您根据您的家庭需要，我们会为您提供您满意的家政服务人员。 【服务项目】本公司长期为家庭、公司、个人提供优质、专业、高效、便捷的日常保洁、新居开荒、做饭、清洁抽油烟机、照顾小孩、小孩接送、照顾老人、医院陪护、照看宠物等的计时服务。 1、保姆：家务、洗衣、做饭、照顾老人、病人护理、接送孩子、带小孩。 2、白班保姆：早来晚走、家务、洗衣、做饭、照顾老人、病人护理、接送孩子、带小孩。 3、月嫂：产褥期护理、新生儿护理、日常家庭保洁整理、一日三餐。 4、育儿嫂：婴儿营养配餐、婴幼儿日常护理、婴幼儿智力开发、家庭日常护理。 5、催乳师：产妇乳房护理、揉奶、开奶。 6、保洁：小时工、新居开荒、日常保洁、地板打蜡、擦玻璃、清洁抽油烟机、疏通下水道。 7、钟点工：上午或下午，做饭、打扫卫生、看护小孩、照顾老人。';

  List<String> imgs = [
    'https://cdn.uviewui.com/uview/album/2.jpg',
    'https://cdn.uviewui.com/uview/album/3.jpg',
    'https://cdn.uviewui.com/uview/album/4.jpg',
    'https://cdn.uviewui.com/uview/album/5.jpg',
    'https://cdn.uviewui.com/uview/album/6.jpg'
  ];

  List<ChargeStandard> prices = [
    ChargeStandard('月嫂', '住家', 6000, '元/月'),
    ChargeStandard('月嫂', '不住家', 4000, '元/月'),
    ChargeStandard('做饭', '住家', 3000, '元/月'),
    ChargeStandard('做饭', '不住家', 2000, '元/月'),
    ChargeStandard('打扫·钟点工', '', 100, '元/时起'),
    ChargeStandard('家电清洗', '', 100, '元/时起'),
    ChargeStandard('接送孩子', '', 2500, '元/月'),
    ChargeStandard('照顾老人/病伤员', '住家', 7000, '元/月'),
    ChargeStandard('照顾老人/病伤员', '不住家', 6000, '元/时起'),
    ChargeStandard('家电清洗', '', 100, '元/时起'),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: BrnAppBar(
          leading: GestureDetector(
            child: Icon(Icons.arrow_back, color: ColorUtils.fromHex('#212121')),
            onTap: () {
              Navigator.of(context).pop();
            },
          ),
          automaticallyImplyLeading: false,
          titleAlignment: Alignment.centerLeft,
          title: Container(
              alignment: Alignment.centerLeft,
              child: Text('申请新商铺/公司详情',
                  style: TextStyle(
                      fontSize: 18,
                      fontFamily: 'Source Han Sans CN',
                      color: ColorUtils.fromHex('#212121'),
                      fontWeight: FontWeight.w500))),
          primary: true,
          backgroundColor: Colors.white),
      body: Scrollbar(
        controller: ScrollController(),
        child: SingleChildScrollView(
            physics: const BouncingScrollPhysics(),
            child: Container(
              color: ColorUtils.fromHex('#F7F7F9'),
              padding: const EdgeInsets.all(10),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  Container(
                    height: 34,
                    alignment: Alignment.center,
                    child: Text('北海家欢家政服务有限公司',
                        style: TextStyle(
                            fontSize: 18,
                            fontFamily: 'PingFangSC-Regular',
                            color: ColorUtils.fromHex('#002440'),
                            fontWeight: FontWeight.w500)),
                  ),
                  ReadMoreText(
                    content,
                    trimLines: 2,
                    style: TextStyle(
                        fontSize: 18,
                        fontWeight: FontWeight.w400,
                        fontFamily: 'PingFangSC-Medium',
                        color: ColorUtils.fromHex('#5A5A5A')),
                    colorClickableText: ColorUtils.fromHex('#3D7EFE'),
                    trimMode: TrimMode.Line,
                    trimCollapsedText: '展开',
                    trimExpandedText: '收起',
                    lessStyle: TextStyle(
                        fontSize: 18,
                        fontWeight: FontWeight.w500,
                        fontFamily: 'PingFangSC-Medium',
                        color: ColorUtils.fromHex('#3D7EFE')),
                    moreStyle: TextStyle(
                        fontSize: 18,
                        fontWeight: FontWeight.w500,
                        fontFamily: 'PingFangSC-Medium',
                        color: ColorUtils.fromHex('#3D7EFE')),
                  ),
                  Container(
                    padding: const EdgeInsets.symmetric(vertical: 10),
                    child: Center(
                      child: SizedBox(
                        height: 1,
                        width: 200,
                        child: Divider(
                          height: 1,
                          color: ColorUtils.fromHex('#D8D8D8'),
                        ),
                      ),
                    ),
                  ),
                  Center(
                    child: Text(
                      '相关资质：',
                      style: TextStyle(
                          fontSize: 18,
                          fontFamily: 'PingFangSC-Regular',
                          color: ColorUtils.fromHex('#002440'),
                          fontWeight: FontWeight.w500),
                    ),
                  ),
                  Container(
                    alignment: Alignment.center,
                    padding: const EdgeInsets.all(10),
                    margin: const EdgeInsets.only(top: 6),
                    decoration: BoxDecoration(
                        color: Colors.white,
                        border: Border.all(
                            color: const Color.fromRGBO(54, 54, 90, 0.3),
                            strokeAlign: BorderSide.strokeAlignOutside),
                        borderRadius:
                            const BorderRadius.all(Radius.circular(6))),
                    child: Wrap(
                      direction: Axis.horizontal,
                      alignment: WrapAlignment.center,
                      runAlignment: WrapAlignment.center,
                      spacing: 10,
                      runSpacing: 15,
                      children: [
                        Container(
                          width: 100,
                          height: 100,
                          clipBehavior: Clip.hardEdge,
                          decoration: BoxDecoration(
                            borderRadius: BorderRadius.circular(5),
                          ),
                          child: Image.network(
                            'https://desk-fd.zol-img.com.cn/t_s960x600c5/g6/M00/03/0E/ChMkKWDZLXSICljFAC1U9uUHfekAARQfgG_oL0ALVUO515.jpg',
                            fit: BoxFit.cover,
                          ),
                        ),
                      ],
                    ),
                  ),
                  Container(
                    height: 56,
                    padding: const EdgeInsets.symmetric(horizontal: 10),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Text('收费标准',
                            style: TextStyle(
                                fontSize: 18,
                                fontFamily: 'Source Han Sans CN',
                                color: ColorUtils.fromHex('#002440'),
                                fontWeight: FontWeight.w500)),
                        MaterialButton(
                            onPressed: () {
                              Navigator.of(context).pop();
                            },
                            height: 36,
                            minWidth: 117,
                            color: ColorUtils.fromHex('#3D7EFE'),
                            shape: const RoundedRectangleBorder(
                                side: BorderSide.none,
                                borderRadius:
                                    BorderRadius.all(Radius.circular(18))),
                            child: const Text(
                              '维护',
                              style: TextStyle(
                                  color: Colors.white,
                                  fontSize: 18,
                                  fontWeight: FontWeight.normal,
                                  fontFamily: 'PingFangSC-Regular'),
                            ))
                      ],
                    ),
                  ),
                  ...createContainer(context),
                  Container(
                    margin: const EdgeInsets.only(top: 10),
                    child: Center(
                      child: Text('备注：以上价格可根据实际服务情况面议',
                          style: TextStyle(
                              fontSize: 18,
                              fontFamily: 'Source Han Sans CN',
                              color: ColorUtils.fromHex('#002440'),
                              fontWeight: FontWeight.w500)),
                    ),
                  )
                ],
              ),
            )),
      ),
      bottomNavigationBar: Container(
        height: 68,
        color: Colors.white,
        alignment: Alignment.center,
        child: MaterialButton(
            onPressed: () {
              Navigator.of(context).pop();
            },
            height: 48,
            minWidth: 117,
            color: ColorUtils.fromHex('#3D7EFE'),
            shape: const RoundedRectangleBorder(
                side: BorderSide.none,
                borderRadius: BorderRadius.all(Radius.circular(5))),
            child: const Text(
              '修改',
              style: TextStyle(
                  color: Colors.white,
                  fontSize: 18,
                  fontWeight: FontWeight.normal,
                  fontFamily: 'PingFangSC-Regular'),
            )),
      ),
    );
  }

  List<Container> createContainer(BuildContext context) {
    return prices.map((e) {
      return Container(
        padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
        decoration: const BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.all(Radius.circular(8))),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Text.rich(TextSpan(children: [
              TextSpan(
                  text: e.name,
                  style: TextStyle(
                      fontSize: 14,
                      fontFamily: 'PingFangSC-Medium',
                      color: ColorUtils.fromHex('#24242C'),
                      fontWeight: FontWeight.w500)),
              TextSpan(
                  text: e.label,
                  style: TextStyle(
                      fontSize: 14,
                      fontFamily: 'PingFangSC-Medium',
                      color: ColorUtils.fromHex('#8C8C9A'),
                      fontWeight: FontWeight.normal))
            ])),
            DefaultTextStyle(
              textAlign: TextAlign.right,
              style: TextStyle(
                  fontSize: 14,
                  fontFamily: 'PingFangSC-Medium',
                  color: ColorUtils.fromHex('#8C8C9A'),
                  fontWeight: FontWeight.normal),
              child: Text(e.price.toString() + e.unit),
            )
          ],
        ),
      );
    }).toList();
  }
}
